package com.cib.xagcjs.web;

import com.cib.xagcjs.biz.PaymentNotifyService;
import com.cib.xagcjs.common.RmbResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 接收区块链推送消息
 * 人民币开放接口
 */
@Controller
@RequestMapping(value = "/pay")
public class PaymentNotifyController {

    @Autowired
    private PaymentNotifyService paymentNotifyService;

    /**
     * 区块链发起
     * @param req 请求
     * @return 执行结果
     */
    @PostMapping("/notify")
    @ResponseBody
    public RmbResponse receiveMessage (@RequestBody String req) {
        return paymentNotifyService.sendMessage(req);
    }
}
